package com.itheima.leetcode.od.c.dynamicprogramming;

import java.util.Arrays;
import java.util.Scanner;

/**
 * <h3>猴子爬山</h3>
 */
public class MonkeyClimbingMountain {
    static int[] cache = new int[51];

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        Arrays.fill(cache, -1);
        cache[0] = 0;
        cache[1] = 1;
        cache[2] = 1;
        cache[3] = 2;

        System.out.println(recursive(n));
    }

    public static int recursive(int n) {
        if (cache[n] != -1) {
            return cache[n];
        }
        cache[n] = recursive(n - 1) + recursive(n - 3);
        return cache[n];
    }
}